/*
 * MVCME framework (www.radoslaw.biz/mvcme)
 * This framework is an attempt of creating MVC pattern for Java ME.
 * Feel free to change and distribute code and binaries of this project.
 * Should you want to provide any feedback, contact me at kowalski@radoslaw.biz
 */

package biz.radoslaw.mvcme.command;

import biz.radoslaw.mvcme.MIDletController;

public class CommandFactory {

    private static MIDletController controller;

    public static Command create(Class commandClass) throws IllegalAccessException, InstantiationException {
        AbstractCommand command =  (AbstractCommand) (commandClass.newInstance());
        command.initialize(controller);
        return command;
    }

    public static void setController(MIDletController controller) {
        CommandFactory.controller = controller;
    }
}
